#!/bin/dash
device_dir="/sys/class/backlight/intel_backlight"
curr_brightness=$(cat "${device_dir}/brightness")
max_brightness=$(cat "${device_dir}/max_brightness")
step=$(($max_brightness / 10))
if [ $1 ]; then new_brightness=$(($curr_brightness + $step))
else new_brightness=$(($curr_brightness - $step)); fi
if [ $new_brightness -gt $max_brightness ]; then new_brightness="$max_brightness"; fi
if [ $new_brightness -lt 1 ]; then new_brightness=1; fi
echo $new_brightness > "${device_dir}/brightness"
